package com.xcity.pomelo.response;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.xcity.game.activity.thirtyday.ThirtyDayRechargeTemplate;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class ThirtyDayRechargeListResponse extends Response {

	private List<RechargeRecordInfo> list;
	
	public static class RechargeRecordInfo implements Comparable<RechargeRecordInfo>{
		public int id;
		public int canGet;
		public int recharged;
		public int rechargeMoney;
		public int rechargeCount;
		public int type;
		public int bond;
		public int money;
		public List<Integer> itemIds;
		public List<Integer> itemCounts;
		public RechargeRecordInfo(ThirtyDayRechargeTemplate temp, int got, int recharged){
			this.id = temp.getId();
			this.recharged = recharged;
			this.canGet = this.recharged - got;
			rechargeMoney = temp.getRechargeMoney();
			rechargeCount = temp.getRechargeCount();
			type = temp.getType();
			
			bond = temp.getBond();
			money = temp.getMoney();
			itemIds = new ArrayList<Integer>();
			itemCounts = new ArrayList<Integer>();
			for(int i = 0; i < temp.getItemIds().length; i++){
				itemIds.add(temp.getItemIds()[i]);
				itemCounts.add(temp.getItemCounts()[i]);
			}
		}
		@Override
		public int compareTo(RechargeRecordInfo o) {
//			if(o.canGet == this.canGet){
//				return rechargeMoney - o.rechargeMoney;
//			}
//			return o.canGet - this.canGet;
			return rechargeMoney - o.rechargeMoney;
		}
	}
	public ThirtyDayRechargeListResponse(int serial, List<RechargeRecordInfo> infoList) {
		super(serial);
		this.list = infoList;
		Collections.sort(this.list);
	}
	public List<RechargeRecordInfo> getList() {
		return list;
	}
	public void setList(List<RechargeRecordInfo> list) {
		this.list = list;
	}
}
